express = require 'express'
router = express.Router()

router.get '/', (req, res) ->
  res.render 'demo/index'

router.post '/', (req, res, next) ->
  req.api.v4.get {
    action: 'product.course.combo.list'
  }
  .then (data) ->
    if not data.status
      return M.Promise.reject new M.errors.TipsError data.msg
    res.json {status: true, data: data.data}
  .catch next
  
module.exports = router

###express = require 'express'
router = express.Router()

router.get '/', (req, res) ->
  res.render 'index'

Sequelize = require 'sequelize'

sequelize = new Sequelize 'cms','root','',{host:'127.0.0.1',dialect:'mysql',define:{freezeTableName:true,timestamps: false}}

User = sequelize.define 'user',{name: Sequelize.STRING,password:Sequelize.STRING,mail:Sequelize.STRING}

User.create (name: 'XiaoMing',password: '1234567890',mail: 'xiaoming@qq.com')
  .then (result) ->
    console.log 'inserted ok'
  .catch (err) ->
    console.log "inserted error"
    console.log err.message


###
